package cn.hr.test_aop;
/**                                        
 *功能描述:演示如何通过AOP拦截方法的           
 * @author  梁耀天             
 * @version   1.0                     
 * create Date April 21, 2010
 */ 
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.hr.test_beans.User;

public class AopDemo {

	 public static void main(String[] args) {
	  ApplicationContext cx = new ClassPathXmlApplicationContext("applicationContext.xml");
	  //测试AOP
	  HelloWorld bean = (HelloWorld)cx.getBean("helloworld");
	  System.out.println(bean.sayHello("Every one !"));
	  System.out.println(bean.greetHello("梁耀天"));//该方法不是say开头,没有被拦截到
	  
	  //测试调用任意一个方法有没有被CommonLogger记录到
	  User user = (User)cx.getBean("user");
	  System.out.println(user.getName());
	 }
}
